package flatlandRPGTest;
import org.lwjgl.util.vector.Vector2f;
import flatlandRPG.GLObject;
import flatlandRPG.GLPrimitive;
import flatlandRPG.GLRectangle;

// -------------------------------------------------------------------------
/**
 *  An abstract test case to test subclasses of GLPrimative.
 *
 *  @author evant
 *  @version Apr 15, 2011
 */
public abstract class AbstractGLPrimitiveTest extends AbstractGLObjectTest
{
    private GLPrimitive testPrimitive;

    // ----------------------------------------------------------
    /**
     * Returns a concrete GLPrimative.
     * @return a concrete GLPrimative
     */
    public abstract GLPrimitive getPrimitive();

    public GLObject getObject() {
        return getPrimitive();
    }

    /**
     * Sets up the test case. This is called before each test method.
     */
    public void setUp() {
        super.setUp();
        testPrimitive = getPrimitive();
    }

    // ----------------------------------------------------------
    /**
     * Tests that draw style is set properly.
     */
    public void testDrawStyle()
    {
        testPrimitive.setDrawStyle(GLRectangle.FILL);
        assertEquals(GLRectangle.FILL, testPrimitive.getDrawStyle());

        testPrimitive.setDrawStyle(GLRectangle.LINE);
        assertEquals(GLRectangle.LINE, testPrimitive.getDrawStyle());

        testPrimitive.setDrawStyle(GLRectangle.POINT);
        assertEquals(GLRectangle.POINT, testPrimitive.getDrawStyle());
    }


    // ----------------------------------------------------------
    /**
     * Tests that setting an invalid draw style dosen't change it.
     */
    public void testInvalidDrawStyle()
    {
        testPrimitive.setDrawStyle(GLRectangle.LINE);
        testPrimitive.setDrawStyle(-22);
        assertEquals(GLRectangle.LINE, testPrimitive.getDrawStyle());
    }

    // ----------------------------------------------------------
    /**
     * Tests the draw method.
     */
    public void testDraw() {
        super.testDraw();
        //testPrimative.draw()
        //I'm not sure how to test this
    }

    /**
     * Get a point inside the object
     * @return A point within the bounds of the object
     */
    public abstract Vector2f getInnerPoint();

    /**
     * Get a point outside the object
     * @return A point outside the bounds of the object
     */
    public abstract Vector2f getOuterPoint();
}
